package com.alex.space.commons.tree;

/**
 * @author Alex
 * Created by Alex on 2018/3/13.
 */
public class TreeUtils {

	public static void inOrderReverse(IEntity root) {

		if (root != null) {
			inOrderReverse(root.left());
			System.out.printf(" %d ", root.data());
			inOrderReverse(root.right());
		}

	}

	public static void preOrderReverse(IEntity root) {

		if (root != null) {
			System.out.printf(" %d ", root.data());
			preOrderReverse(root.left());
			preOrderReverse(root.right());
		}
	}

	public static void postOrderReverse(IEntity root) {

		if (root != null) {
			postOrderReverse(root.left());
			postOrderReverse(root.right());
			System.out.printf(" %d ", root.data());
		}
	}

}
